<html>
    <head>
        <title>Reactive DDD with Akka</title>
    </head>
    <body>
<h1>ddd-leaven-akka-v2</h1>

<p><em>Reactive DDD with Akka</em></p>
<div>
<h2>Overview</h2>

<p>This sample e-commerce system has unique set of properties. It is:</p>

<ul class="task-list">
<li>responsive, resilient, elastic,</li>
<li>incorporates a SOA, EDA, and Microservice architecture,</li>
<li>incorporates <a href="http://abdullin.com/post/dddd-cqrs-and-other-enterprise-development-buzz-words">CQRS/DDDD</a> architectural patterns,</li>
<li>supporting long-running business processes (eg. payment deadlines), and</li>
<li>developer-friendly (implemented in Scala, ~1500 lines of code).</li>
</ul>

<p>All these capabilities are obviously supported by the underlying technology stack, which includes:</p>

<ul class="task-list">
<li><p><a href="http://akka.io">Akka</a> - actor-based, reactive middleware implemented in Scala,</p></li>
<li><p><a href="http://doc.akka.io/docs/akka/2.4/scala/http/introduction.html">Akka HTTP</a> - HTTP server build upon Akka Stream (Akka's implementation of <a href="http://www.reactive-streams.org/">Reactive Streams Specification</a>),</p></li>
<li><p><a href="http://doc.akka.io/docs/akka/current/scala/persistence.html">Akka Persistence</a> - infrastructure for building durable (event sourced) actors, which has a pluggable journal,</p></li>
<li>
<p><a href="http://geteventstore.com">Event Store</a> - scalable, highly available event store with akka-persistence journal implementation. Provides engine for running user-defined projections (javascript functions) over single or multiple  event streams. Projections allow the system to group or combine events into new event streams that can represent domain-level journals such as office journals (events grouped by emitter (<code>Aggregate Root</code>) class) or business process journals (events related to concrete business process). Domain journals are topic of interest for services such as:</p>

<ul class="task-list">
<li><b>view updaters</b> - responsible for updating the read side of the system </li>
<li><b>receptors</b> - allow event-driven interaction between subsystems (event choreography), including long-running processes (sagas), and</li>
</ul>
</li>
    <p>Both view uppdaters and receptors are operating within non-blocking <b>back-pressured</b> event processing pipeline </p>
<li><p><a href="http://github.com/pawelkaczor/akka-ddd">Akka-DDD</a> - framework containing glue-code and all building blocks</p></li>
</ul>
</div>
<div>
<h2>Subsystems</h2>

<p>The system currently consists of the following subsystems:</p>

<ul class="task-list">
<li>Sales/Reservation - responsible for creating and confirming Reservations</li>
<li>Invoicing - responsible for the invoicing</li>
<li>Shipping - responsible for the goods delivery</li>
<li>Headquarters - executes the Ordering Process (see below)</li>
</ul>
</div>
<div>
    <h2>Ordering Process</h2>
    <img src="https://raw.githubusercontent.com/pawelkaczor/ddd-leaven-akka-v2/master/project/diagrams/OrderingSystem.png">
</div>
<div>
<h2>Applications</h2>

<p>Each subsystem is divided into <strong>write</strong> and <strong>read</strong> side, each side containing <strong>back-end</strong> and <strong>front-end</strong> application: </p>
    <img src="https://camo.githubusercontent.com/e409f553ba96b8ff73586f0468738fab13a5e202/68747470733a2f2f646f63732e676f6f676c652e636f6d2f64726177696e67732f642f31324c7777713357524f6c7532706b5873497749435176755769504e4b573558517763376252744c616175492f7075623f773d37323226616d703b683d363230">
<hr>

<h4>write-back</h4>

<p>Backend cluster node hosting <code>Aggregate Roots</code>, <code>Receptors</code> and <code>Process Managers (Sagas)</code>.</p>

<h4>write-front</h4>

<p>HTTP server forwarding commands to backend cluster. </p>

<hr>

<h4>read-back</h4>

<p>View update service that consumes events from event store and updates view store (PostgreSQL database).</p>

<h4>read-front</h4>

<p>HTTP server providing rest endpoint for accessing view store. </p>
</div>
<div>
    <h2>Running and testing the system</h2>
    <ul>
        <li><a href="https://github.com/pawelkaczor/ddd-leaven-akka-v2/wiki/Running-the-system-on-physical-server">Running the system on physical server</a></li>
        <li><a href="https://github.com/pawelkaczor/ddd-leaven-akka-v2/wiki/Running-virtualized-system">Running virtualized system</a></li>
        <li><a href="https://github.com/pawelkaczor/ddd-leaven-akka-v2/wiki/Manual-testing-of-order-process">Manual testing of order process</a></li>
        <li><a href="https://github.com/pawelkaczor/ddd-leaven-akka-v2/wiki/End-to-end-test-of-order-process">End-to-end test of order process</a></li>
        <li><a href="https://github.com/pawelkaczor/ddd-leaven-akka-v2/wiki/Stress-testing">Stress testing</a></li>
        <li><a href="https://github.com/pawelkaczor/ddd-leaven-akka-v2/wiki/Monitoring">Monitoring</a></li>
    </ul>
</div>
</body>
</html>